package com.pubinfo.passbook.common.model.dto.open;

import com.pubinfo.passbook.common.entity.TFileOpenElectronicFtp;
import com.pubinfo.passbook.common.entity.TFileOpenEnclosureFtp;
import com.pubinfo.passbook.common.entity.TFileOpenFtp;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.web.multipart.MultipartFile;

@Data
@NoArgsConstructor
@ApiModel(value = "WiteoffAttchment", description = "报账单文件数据")
public class WiteoffAttchment {
  @ApiModelProperty(hidden = true)
  private String id;
  @ApiModelProperty(value = "附件文件名,必须与文件files 中的相应每个文件名对应", hidden = true)
  private String attchmentName;
  @ApiModelProperty(value = "区分附件，电子签章与电子发票\t 0：附件，1：电子签章文件，2;电子发票（不传默认为0）")
  private Integer fileType;
  @ApiModelProperty(value = "附件或者是发票文件")
  private MultipartFile file;
  @ApiModelProperty(value = "Md5秘钥", hidden = true)
  private String md5Key;
  @ApiModelProperty(value = "审核资料地址", hidden = true)
  private String attchmentAdd;
  
  public void setWiteoffAttchment(TFileOpenElectronicFtp ftp) {
    this.attchmentName = ftp.getName();
    this.fileType = 2;
    this.attchmentAdd = ftp.getFileRelativePath();
    this.md5Key = ftp.getMd5Code();
  }
  public void setWiteoffAttchment(TFileOpenEnclosureFtp ftp) {
    this.attchmentName = ftp.getName();
    this.fileType = 0;
    this.attchmentAdd = ftp.getHttp();
  }

}
